﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;

namespace CommunitySystemModel
{
   public  class TuiXiuModel
    {
        private int _Sec;
        [DataMember]
        public int Sec
        {
            get { return _Sec; }
            set { _Sec = value; }
        }
        private int _ID;
        [DataMember]
        public int ID
        {
            get { return _ID; }
            set { _ID = value; }
        }
        private int _OrgID;
        [DataMember]
        public int OrgID
        {
            get { return _OrgID; }
            set { _OrgID = value; }
        }
        private int _EmpbasicID;
        [DataMember]
        public int EmpbasicID
        {
            get { return _EmpbasicID; }
            set { _EmpbasicID = value; }
        }

        private string _Status;
        [DataMember]
        public string Status
        {
            get { return _Status; }
            set { _Status = value; }
        }

        private string _WenHao;
        [DataMember]
        public string WenHao
        {
            get { return _WenHao; }
            set { _WenHao = value; }
        }

        private string _YuanYin;
        [DataMember]
        public string YuanYin
        {
            get { return _YuanYin; }
            set { _YuanYin = value; }
        }

        private DateTime? _PiZhunDate;
        [DataMember]
        public DateTime? PiZhunDate
        {
            get { return _PiZhunDate; }
            set { _PiZhunDate = value; }
        }

        private string _OrgName;
        [DataMember]
        public string OrgName
        {
            get { return _OrgName; }
            set { _OrgName = value; }
        }

        private string _Name;
        [DataMember]
        public string Name
        {
            get { return _Name; }
            set { _Name = value; }
        }

        private string _PositionName;
        [DataMember]
        public string PositionName
        {
            get { return _PositionName; }
            set { _PositionName = value; }
        }

        private string _DutyNo;
        [DataMember]
        public string DutyNo
        {
            get { return _DutyNo; }
            set { _DutyNo = value; }
        }

        public static TuiXiuModel FillEntity(DataRow dr)
        {
            TuiXiuModel right = new TuiXiuModel();
            if (dr.Table != null && dr.Table.Columns.Contains("EmpbasicID")) right.EmpbasicID = Convert.ToInt32(dr["EmpbasicID"]);
            if (dr.Table != null && dr.Table.Columns.Contains("ID")) right.ID = Convert.ToInt32(dr["ID"]);
            if (dr.Table != null && dr.Table.Columns.Contains("Status")) if (!string.IsNullOrEmpty(dr["Status"].ToString())) right.Status = dr["Status"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("Sec")) if (!string.IsNullOrEmpty(dr["Sec"].ToString())) right.Sec = Convert.ToInt32(dr["Sec"]);
            if (dr.Table != null && dr.Table.Columns.Contains("OrgID")) if (!string.IsNullOrEmpty(dr["OrgID"].ToString())) right.OrgID = Convert.ToInt32(dr["OrgID"]);

            if (dr.Table != null && dr.Table.Columns.Contains("WenHao")) if (!string.IsNullOrEmpty(dr["WenHao"].ToString())) right.WenHao = dr["WenHao"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("YuanYin")) if (!string.IsNullOrEmpty(dr["YuanYin"].ToString())) right.YuanYin = dr["YuanYin"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("OrgName")) if (!string.IsNullOrEmpty(dr["OrgName"].ToString())) right.OrgName = dr["OrgName"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("Name")) if (!string.IsNullOrEmpty(dr["Name"].ToString())) right.Name = dr["Name"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("PositionName")) if (!string.IsNullOrEmpty(dr["PositionName"].ToString())) right.PositionName = dr["PositionName"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("DutyNo")) if (!string.IsNullOrEmpty(dr["DutyNo"].ToString())) right.DutyNo = dr["DutyNo"].ToString();


            if (dr.Table != null && dr.Table.Columns.Contains("PiZhunDate")) if (!string.IsNullOrEmpty(dr["PiZhunDate"].ToString()) && Convert.ToDateTime(dr["PiZhunDate"]) != Convert.ToDateTime("1900-01-01")) right.PiZhunDate = Convert.ToDateTime(dr["PiZhunDate"]);

            return right;
        }
    }
}
